version 18.5
use "datafile.dta", clear

********************************************************************************
**** Dataprep ******************************************************************
********************************************************************************
*ssc install cibar
*ssc install floatplot
drop if straightliner==1

label define country 1"USA" 2"Sweden" 3"South Africa" 4"India" 5"Germany" 6"Brazil"
label val country country

foreach var of varlist q1_* {
	recode `var' 1/3=0 4/5=1 , gen(pro_`var')
}

foreach var of varlist q1_* {
	recode `var' 1=1 2/5=0, gen(neg1_`var')
}

foreach var of varlist q1_* {
	recode `var' 1/2=1 3/5=0, gen(neg2_`var')
}

gen gap_tax = q1_1-q1_16
gen gap_sub = q1_2-q1_17
gen gap_mar = q1_4-q1_18

* Global north vs south
gen gsouth=.
replace gsouth=0 if country==1 | country==2 | country==5
replace gsouth=1 if country==3 | country==4 | country==6

********************************************************************************
****************** Controls ****************************************************
********************************************************************************
recode q15_1 2=0, gen(eatmeat)
recode q15_4 2=0, gen(vegetarian)
label define binary 0"No" 1"Yes"
label val eatmeat binary
label val vegetarian binary

***** Categorical variables --> dummy variables
qui tab age_3,		gen(agecat)
qui tab education,	gen(educat)
qui tab urban,		gen(urbcat)
qui tab pinc,		gen(inccat)

***** Objective ideology
gen ideology=(q9_1 + q9_4 + q9_5)/3

***** Political trust
*factor q10_1 q10_2 q10_3 q10_4 q10_5 q10_6 q10_7
*rotate
**loadingplot
*alpha q10_2 q10_4 q10_5 q10_6 q10_7, item
*alpha q10_2 q10_5 q10_6 q10_7, item
*alpha q10_2 q10_6 q10_7, item
alpha q10_5 q10_6 q10_7, item gen(polindex)
gen poltrust=polindex-1

***** Policy Specific Beliefs
*** Taxes and bans
gen tax_fair	= Q5d //taxes fairness
gen tax_eff		= Q5e //taxes effectiveness
gen tax_free	= Q5f //taxes freedom
*** Subsidies
gen sub_fair	= Q5a //fairness subsidies
gen sub_eff		= Q5b //effectiveness subsidies
gen sub_free	= Q5c //freedom subsidies


**************************************************************
***** Standardizing variables
egen std_gender=std(gender)
egen std_agecat1=std(agecat1)
egen std_agecat2=std(agecat2)
egen std_agecat3=std(agecat3)
egen std_educat1=std(educat1)
egen std_educat2=std(educat2)
egen std_educat3=std(educat3)
egen std_urbcat1=std(urbcat1)
egen std_urbcat2=std(urbcat2)
egen std_urbcat3=std(urbcat3)
egen std_inccat1=std(inccat1)
egen std_inccat2=std(inccat2)
egen std_inccat3=std(inccat3)
egen std_lr=std(lr)
egen std_ideology=std(ideology)
egen std_climate_concern=std(climate_concern)
egen std_poltrust=std(poltrust)
egen std_eatmeat=std(eatmeat)
egen std_vegetarian=std(vegetarian)
egen std_tax_fair=std(tax_fair)
egen std_tax_eff=std(tax_eff)
egen std_tax_free=std(tax_free)
egen std_sub_fair=std(sub_fair)
egen std_sub_eff=std(sub_eff)
egen std_sub_free=std(sub_free)

**** Labels
label var std_gender			"Female"
label var std_agecat1			"18-34 years"
label var std_agecat2			"35-54 years"
label var std_agecat3			"55+ years"
label var std_educat1			"Low"
label var std_educat2			"Medium"
label var std_educat3			"High"
label var std_urbcat1			"Urban"
label var std_urbcat2			"Suburban"
label var std_urbcat3			"Rural"
label var std_inccat1			"low"
label var std_inccat2			"Medium"
label var std_inccat3			"High"
label var std_lr				"Ideology"
label var std_ideology			"Ideology"
label var climate_concern		"Climate concern"
label var std_climate_concern	"Climate concern"
label var poltrust				"Political trust"
label var std_poltrust			"Political trust"
label var eatmeat				"Eat meat? Yes"
label var std_eatmeat			"Eat meat? Yes"
label var vegetarian			"Vegetarian: Yes"
label var std_vegetarian		"Vegetarian: Yes"
label var std_tax_fair			"Taxes: Fair"
label var std_tax_eff			"Taxes: Eff"
label var std_tax_free			"Taxes: Free"
label var std_sub_fair			"Subsidies: Fair"
label var std_sub_eff			"Subsidies: Eff"
label var std_sub_free			"Subsidies: Free"
**************************************************************

**** Global
global tax "q1_1 q1_16"
global sub "q1_2 q1_17"
global mar "q1_4 q1_18"
global dvars "q1_1 q1_2 q1_4 q1_16 q1_17 q1_18"
global provar "pro_q1_1 pro_q1_2 pro_q1_4 pro_q1_16 pro_q1_17 pro_q1_18"
global gap "gap_tax gap_sub gap_mar"

global ivars "std_ideology std_climate_concern std_poltrust std_vegetarian std_gender std_agecat2 std_agecat3 std_educat2 std_educat3 std_urbcat2 std_urbcat3 std_inccat2 std_inccat3"

global psb_tax	"std_tax_fair std_tax_eff std_tax_free"
global psb_sub	"std_sub_fair std_sub_eff std_sub_free"

********** Figure 1 ************************************************************
* Data
foreach var of varlist q1_* {
	tab `var'
}
bysort country: tab q1_1
bysort country: tab q1_2
bysort country: tab q1_4
bysort country: tab q1_16
bysort country: tab q1_17
bysort country: tab q1_18

/*
preserve
foreach var of varlist q1_* {
	recode `var' 1/2=1 3/5=0, gen(neg_`var')
	recode `var' 1/3=0 4/5=1, gen(pos_`var')
}
collapse (mean) neg_* pos_*, by(country)

gen c_tax_bal=pos_q1_1-neg_q1_1
gen c_sub_bal=pos_q1_2-neg_q1_2
gen c_mar_bal=pos_q1_4-neg_q1_4
gen h_tax_bal=pos_q1_16-neg_q1_16
gen h_sub_bal=pos_q1_17-neg_q1_17
gen h_mar_bal=pos_q1_18-neg_q1_18

foreach var of varlist c_* h_* {
	tab
}
restore
*/

********** Figure 2 & 3 ********************************************************
********** Analysis of resistance (strongly against and somwehat against) ******
********** All countries
* Table name
global tabname "fig2_all"

* Regression(s)
timer clear
local x=0
local z = ""

foreach dv of varlist neg2_* {
local x=`x'+1
di "Column `x'"
timer on `x'
qui logit `dv' $ivars [pweight=weight], robust
local z`x' m_`x'
local z = "`z'" + " `z`x''"
est store m_`x'
local m="c`x'"
*estimates save "output/$tabname`m'", replace
timer off `x'
timer list `x'
}

* In Stata output window
esttab `z' , ///
	mtitles("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	addnotes("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) r2(3) ///
	legend

* Excel-file
estout `z' using "output/$tabname.xls", replace ///
	mlabels("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	postfoot("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par(`"="("' `")""') fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	legend
	

********** Global north and global south
* Table name
global tabname "fig2_ns"

* Regression(s)
timer clear
local x=0
local z = ""

foreach i of num 0/1 {
foreach dv of varlist neg2_* {
local x=`x'+1
di "Column `x'"
timer on `x'
qui logit `dv' $ivars [pweight=weight] if gsouth==`i', robust
local z`x' m`i'_`x'
local z = "`z'" + " `z`x''"
est store m`i'_`x'
local m="c`x'"
*estimates save "output/$tabname`m'", replace
timer off `x'
timer list `x'
}
}

* In Stata output window
esttab `z' , ///
	mtitles("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	addnotes("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) r2(3) ///
	legend

* Excel-file
estout `z' using "output/$tabname.xls", replace ///
	mlabels("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	postfoot("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par(`"="("' `")""') fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	legend

	
************* Plots

********* All countries, by design (Figure 2)
set scheme white_tableau
graph set window fontface "Arial"
coefplot (m_1, msymbol(T) mlcolor("179 21 41") mfcolor("179 21 41") ciopts(lcolor("179 21 41"))) (m_4, msymbol(O) mlcolor("16 101 171") mfcolor("16 101 171") ciopts(lcolor("16 101 171"))), bylabel(Tax) || m_2 m_5, bylabel(Subsidy) || m_3 m_6, bylabel(Marketing) drop(_cons) xline(0) xlabel(-.6(.2).2, gmin gmax) ///
			subtitle(, bcolor(white)) ///
			headings(std_gender="{it:Gender}" std_agecat2="{it:Age}" ///
			std_educat2="{it:Education}" std_urbcat2="{it:Region}" ///
			std_inccat2="{it:Personal income}", labs(small)) ///
			groups(std_gender std_inccat3 = "{bf:Sociodemographics}" ///
			std_ideology std_vegetarian = "{bf:Misc.}", ang(90)) ///				   
			byopts(row(1) note("All countries", ring(10) pos(12) size(*1.5) span)) ///
			legend(order(2 "Climate-motivated" 4 "Health-motivated") row(1) pos(6)) ///
			name(fig2_bd_all, replace) ysize(3) xsize(3) graphregion(margin(zero))

graph combine fig2_bd_all, title("") iscale(.8) ysize(3) xsize(3) graphregion(margin(zero)) col(1) name("fig2_bd_all_panel", replace)
gr export "figures/fig2_bd_all.png", as(png) name("fig2_bd_all_panel") replace
gr export "figures/fig2_bd_all.pdf", as(pdf) name("fig2_bd_all_panel") replace	
gr export "figures/fig2_bd_all.eps", as(eps) name("fig2_bd_all_panel") replace

*** North, by design
set scheme white_tableau
graph set window fontface "Arial"
coefplot	(m0_1, msymbol(T) mlcolor("179 21 41") mfcolor("179 21 41") ciopts(lcolor("179 21 41"))) (m0_4, msymbol(O) mlcolor("16 101 171") mfcolor("16 101 171") ciopts(lcolor("16 101 171"))), bylabel(Tax) || m0_2 m0_5, bylabel(Subsidy) || m0_3 m0_6, bylabel(Marketing) drop(_cons) xline(0) xlabel(-.6(.2).2, gmin gmax) ///
			subtitle(, bcolor(white)) ///
			headings(std_gender="{it:Gender}" std_agecat2="{it:Age}" ///
			std_educat2="{it:Education}" std_urbcat2="{it:Region}" ///
			std_inccat2="{it:Personal income}", labs(small)) ///
			groups(std_gender std_inccat3 = "{bf:Sociodemographics}" ///
			std_ideology std_vegetarian = "{bf:Misc.}", ang(90)) ///
			byopts(row(1) legend(off) note("Global North", ring(10) pos(12) size(*1.5) span)) ///
			name(fig3_bd_north, replace) xsize(5) graphregion(margin(zero))
gr export "figures/fig3_bd_north.png", as(png) name("fig3_bd_north") replace


*** South, by design
set scheme white_tableau
graph set window fontface "Arial"
coefplot	(m1_7, msymbol(T) mlcolor("179 21 41") mfcolor("179 21 41") ciopts(lcolor("179 21 41"))) (m1_10, msymbol(O) mlcolor("16 101 171") mfcolor("16 101 171") ciopts(lcolor("16 101 171"))), bylabel(Tax) || m1_8 m1_11, bylabel(Subsidy) || m1_9 m1_12, bylabel(Marketing) drop(_cons) xline(0) xlabel(-.6(.2).2, gmin gmax) ///
			subtitle(, bcolor(white)) ///
			headings(std_gender="{it:Gender}" std_agecat2="{it:Age}" ///
			std_educat2="{it:Education}" std_urbcat2="{it:Region}" ///
			std_inccat2="{it:Personal income}", labs(small)) ///
			groups(std_gender std_inccat3 = "{bf:Sociodemographics}" ///
			std_ideology std_vegetarian = "{bf:Misc.}", ang(90)) ///
			byopts(row(1) note("Global South", ring(10) pos(12) size(*1.5) span)) ///
			legend(order(2 "Climate-motivated" 4 "Health-motivated") row(1) pos(6)) ///
			name(fig3_bd_south, replace) xsize(5) graphregion(margin(zero))
gr export "figures/fig3_bd_south.png", as(png) name("fig3_bd_south") replace

*** North/south panel, by design (Figure 3)
graph combine fig3_bd_north fig3_bd_south, title("") iscale(.8) xsize(3) graphregion(margin(zero)) col(1) name("fig3_bd_ns_panel", replace)
gr export "figures/fig3_bd_ns_panel.pdf", as(pdf) name("fig3_bd_ns_panel") replace
gr export "figures/fig3_bd_ns_panel.eps", as(eps) name("fig3_bd_ns_panel") replace
gr export "figures/fig3_bd_ns_panel.png", as(png) name("fig3_bd_ns_panel") replace



*** All countries, all designs in one (supplementaries?)
set scheme white_tableau
graph set window fontface "Arial"
coefplot	(m_1, msymbol(T) mlcolor("179 21 41") mfcolor("179 21 41") ciopts(lcolor("179 21 41"))) (m_2, msymbol(T) mlcolor("16 101 171") mfcolor("16 101 171") ciopts(lcolor("16 101 171"))) (m_3, msymbol(T) mlcolor("254 219 199") mfcolor("254 219 199") ciopts(lcolor("254 219 199"))) (m_4, msymbol(O) mlcolor("179 21 41") mfcolor("179 21 41") ciopts(lcolor("179 21 41"))) (m_5, msymbol(O) mlcolor("16 101 171") mfcolor("16 101 171") ciopts(lcolor("16 101 171"))) (m_6, msymbol(O) mlcolor("254 219 199") mfcolor("254 219 199") ciopts(lcolor("254 219 199"))), ///
			drop(_cons) xline(0) xlabel(-.6(.2).2, gmin gmax) ///
			subtitle(All countries, bcolor(white)) ///
			headings(std_gender="{it:Gender}" std_agecat2="{it:Age}" ///
			std_educat2="{it:Education}" std_urbcat2="{it:Region}" ///
			std_inccat2="{it:Personal income}", labs(small)) ///
			groups(std_gender std_inccat3 = "{bf:Sociodemographics}" ///
			std_ideology std_vegetarian = "{bf:Misc.}", ang(90)) ///
			byopts(row(1)) legend(order(2 "Tax: climate" 4 "Subsidy: climate" 6 "Marketing: climate" 8 "Tax: health" 10 "Subsidy: health" 12 "Marketing: health") row(2) pos(6)) ///
			name(fig2_all, replace)
*gr export "figures/fig2_coefplot_all.png", as(png) name("fig2_all") replace


*** North, all designs in one (supplementaries?)
set scheme white_tableau
graph set window fontface "Arial"
coefplot	(m0_1, msymbol(T) mlcolor("179 21 41") mfcolor("179 21 41") ciopts(lcolor("179 21 41"))) (m0_2, msymbol(T) mlcolor("16 101 171") mfcolor("16 101 171") ciopts(lcolor("16 101 171"))) (m0_3, msymbol(T) mlcolor("254 219 199") mfcolor("254 219 199") ciopts(lcolor("254 219 199"))) (m0_4, msymbol(O) mlcolor("179 21 41") mfcolor("179 21 41") ciopts(lcolor("179 21 41"))) (m0_5, msymbol(O) mlcolor("16 101 171") mfcolor("16 101 171") ciopts(lcolor("16 101 171"))) (m0_6, msymbol(O) mlcolor("254 219 199") mfcolor("254 219 199") ciopts(lcolor("254 219 199"))), ///
			drop(_cons) xline(0) xlabel(-.6(.2).2, gmin gmax) ///
			subtitle(Global North, bcolor(white)) ///
			headings(std_gender="{it:Gender}" std_agecat2="{it:Age}" ///
			std_educat2="{it:Education}" std_urbcat2="{it:Region}" ///
			std_inccat2="{it:Personal income}", labs(small)) ///
			groups(std_gender std_inccat3 = "{bf:Sociodemographics}" ///
			std_ideology std_vegetarian = "{bf:Misc.}", ang(90)) ///
			byopts(row(1)) legend(order(2 "Tax: climate" 4 "Subsidy: climate" 6 "Marketing: climate" 8 "Tax: health" 10 "Subsidy: health" 12 "Marketing: health") row(2) pos(6)) ///
			name(fig2_north, replace)
*gr export "figures/fig2_coefplot_north.png", as(png) name("fig2_north") replace


*** South, all designs in one (supplementaries?)
set scheme white_tableau
graph set window fontface "Arial"
coefplot	(m1_7, msymbol(T) mlcolor("179 21 41") mfcolor("179 21 41") ciopts(lcolor("179 21 41"))) (m1_8, msymbol(T) mlcolor("16 101 171") mfcolor("16 101 171") ciopts(lcolor("16 101 171"))) (m1_9, msymbol(T) mlcolor("254 219 199") mfcolor("254 219 199") ciopts(lcolor("254 219 199"))) (m1_10, msymbol(O) mlcolor("179 21 41") mfcolor("179 21 41") ciopts(lcolor("179 21 41"))) (m1_11, msymbol(O) mlcolor("16 101 171") mfcolor("16 101 171") ciopts(lcolor("16 101 171"))) (m1_12, msymbol(O) mlcolor("254 219 199") mfcolor("254 219 199") ciopts(lcolor("254 219 199"))), ///
			drop(_cons) xline(0) xlabel(-6(.2).2, gmin gmax) ///
			subtitle(Global South, bcolor(white)) ///
			headings(std_gender="{it:Gender}" std_agecat2="{it:Age}" ///
			std_educat2="{it:Education}" std_urbcat2="{it:Region}" ///
			std_inccat2="{it:Personal income}", labs(small)) ///
			groups(std_gender std_inccat3 = "{bf:Sociodemographics}" ///
				   std_ideology std_vegetarian = "{bf:Misc.}", ang(90)) ///
			byopts(row(1)) legend(order(2 "Tax: climate" 4 "Subsidy: climate" 6 "Marketing: climate" 8 "Tax: health" 10 "Subsidy: health" 12 "Marketing: health") row(2) pos(6)) ///
			name(fig2_south, replace)
*gr export "figures/fig2_coefplot_south.png", as(png) name("fig2_south") replace


********* Panel, all designs in one
set scheme white_tableau
graph set window fontface "Arial"
coefplot (m_1, msymbol(T) mlcolor("179 21 41") mfcolor("179 21 41") ciopts(lcolor("179 21 41"))) (m_2, msymbol(T) mlcolor("16 101 171") mfcolor("16 101 171") ciopts(lcolor("16 101 171"))) (m_3, msymbol(T) mlcolor("254 219 199") mfcolor("254 219 199") ciopts(lcolor("254 219 199"))) (m_4, msymbol(O) mlcolor("179 21 41") mfcolor("179 21 41") ciopts(lcolor("179 21 41"))) (m_5, msymbol(O) mlcolor("16 101 171") mfcolor("16 101 171") ciopts(lcolor("16 101 171"))) (m_6, msymbol(O) mlcolor("254 219 199") mfcolor("254 219 199") ciopts(lcolor("254 219 199"))), bylabel(All countries) || m0_1 m0_2 m0_3 m0_4 m0_5 m0_6, bylabel(Global North) || m1_7 m1_8 m1_9 m1_10 m1_11 m1_12, bylabel(Global South) drop(_cons) xline(0) xlabel(-.6(.2).2, gmin gmax) ///
			subtitle(, bcolor(white)) ///
			headings(std_gender="{it:Gender}" std_agecat2="{it:Age}" ///
			std_educat2="{it:Education}" std_urbcat2="{it:Region}" ///
			std_inccat2="{it:Personal income}", labs(small)) ///
			groups(std_gender std_inccat3 = "{bf:Sociodemographics}" ///
			std_ideology std_vegetarian = "{bf:Misc.}", ang(90)) ///				   
			byopts(row(1)) legend(order(2 "Tax: climate" 4 "Subsidy: climate" 6 "Marketing: climate" 8 "Tax: health" 10 "Subsidy: health" 12 "Marketing: health") row(2) pos(6)) ///
			name(fig2_coefplot_panel, replace)
*gr export "figures/fig2_coefplot_panel.pdf", as(pdf) name("fig2_coefplot_panel") replace	
*gr export "figures/fig2_coefplot_panel.eps", as(eps) name("fig2_coefplot_panel") replace
*gr export "figures/fig2_coefplot_panel.png", as(png) name("fig2_coefplot_panel") replace
est clear









********************************************************************************


********************************************************************************
************** Supplementary Information ***************************************
********************************************************************************
**** Descriptive statistics
* Table 1. Interview period and sample size
tab country

* Table 2. Dependent variables descriptive statistics
foreach var of varlist q1_1 q1_16 q1_2 q1_17 q1_4 q1_18 {
	sum `var'
}
sum q1_1 q1_16 q1_2 q1_17 q1_4 q1_18 if country==6 //Brazil
sum q1_1 q1_16 q1_2 q1_17 q1_4 q1_18 if country==5 //Germany
sum q1_1 q1_16 q1_2 q1_17 q1_4 q1_18 if country==4 //India
sum q1_1 q1_16 q1_2 q1_17 q1_4 q1_18 if country==3 //South Africa
sum q1_1 q1_16 q1_2 q1_17 q1_4 q1_18 if country==2 //Sweden
sum q1_1 q1_16 q1_2 q1_17 q1_4 q1_18 if country==1 //USA

* Table 3. Tabulation of dependent variables
tab q1_1	if country== //change for respective country
tab q1_16	if country== //change for respective country
tab q1_2	if country== //change for respective country
tab q1_17	if country== //change for respective country
tab q1_4	if country== //change for respective country
tab q1_18	if country== //change for respective country

* Table 4. Independent variables descriptive statistics
sum ideology climate_concern poltrust
foreach i of numlist 6 5 4 3 2 1 {
	tab country if country==`i'
	sum ideology climate_concern poltrust if country==`i'
}
tab vegetarian	if country==1 //change for respective country
tab gender		if country==1 //change for respective country
tab age_3		if country==1 //change for respective country
tab education	if country==1 //change for respective country
tab urban		if country==1 //change for respective country
tab pinc		if country==1 //change for respective country


********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
* Table x. Two-sample test of resistance (strongly against and somewhat against) proportions
tab neg2_q1_1	if country==1 //tax climate
tab neg2_q1_16	if country==1 //tax health
tab neg2_q1_2	if country==1 //sub climate
tab neg2_q1_17	if country==1 //sub health
tab neg2_q1_4	if country==1 //marketing climate
tab neg2_q1_18	if country==1 //marketing health
prtesti 3435 0.3267 4069 0.3870 //All countries, tax
prtesti 2059 0.1959 1764 0.1678 //All countries, sub
prtesti 2830 0.2692 3204 0.3048 //All countries, marketing
prtesti 482 0.2840 648 0.3819 //Brazil, tax
prtesti 263 0.1550 254 0.1497 //Brazil, sub
prtesti 409 0.2410 619 0.3648 //Brazil, marketing
prtesti 667 0.3669 844 0.4642 //Germany, tax
prtesti 400 0.2200 273 0.1502 //Germany, sub
prtesti 435 0.2393 448 0.2464 //Germany, marketing
prtesti 403 0.2447 365 0.2216 //India, tax
prtesti 308 0.1870 328 0.1991 //India, sub
prtesti 353 0.2143 348 0.2113 //India, marketing
prtesti 422 0.2406 520 0.2965 //South Africa, tax
prtesti 231 0.1317 234 0.1334 //South Africa, sub
prtesti 335 0.1910 438 0.2497 //South Africa, marketing
prtesti 718 0.3862 776 0.4174 //Sweden, tax
prtesti 393 0.2114 307 0.1651 //Sweden, sub
prtesti 606 0.3260 600 0.3228 //Sweden, marketing
prtesti 743 0.4275 916 0.5270 //USA, tax
prtesti 464 0.2670 368 0.2117 //USA, sub
prtesti 692 0.3982 751 0.4321 //USA, marketing

* Table x. ttests
** tax
ttest q1_1 == q1_16
esize unpaired q1_1 == q1_16, cohensd
ttest q1_1 == q1_16				if country==6
esize unpaired q1_1 == q1_16	if country==6, cohensd
ttest q1_1 == q1_16				if country==5
esize unpaired q1_1 == q1_16	if country==5, cohensd
ttest q1_1 == q1_16				if country==4
esize unpaired q1_1 == q1_16	if country==4, cohensd
ttest q1_1 == q1_16				if country==3
esize unpaired q1_1 == q1_16	if country==3, cohensd
ttest q1_1 == q1_16				if country==2
esize unpaired q1_1 == q1_16	if country==2, cohensd
ttest q1_1 == q1_16				if country==1
esize unpaired q1_1 == q1_16	if country==1, cohensd

** subsidy
ttest q1_2 == q1_17
esize unpaired q1_2 == q1_17, cohensd
ttest q1_2 == q1_17				if country==6
esize unpaired q1_2 == q1_17	if country==6, cohensd
ttest q1_2 == q1_17				if country==5
esize unpaired q1_2 == q1_17	if country==5, cohensd
ttest q1_2 == q1_17				if country==4
esize unpaired q1_2 == q1_17	if country==4, cohensd
ttest q1_2 == q1_17				if country==3
esize unpaired q1_2 == q1_17	if country==3, cohensd
ttest q1_2 == q1_17				if country==2
esize unpaired q1_2 == q1_17	if country==2, cohensd
ttest q1_2 == q1_17				if country==1
esize unpaired q1_2 == q1_17	if country==1, cohensd

** marketing
ttest q1_4 == q1_18
esize unpaired q1_4 == q1_18, cohensd
ttest q1_4 == q1_18				if country==6
esize unpaired q1_4 == q1_18	if country==6, cohensd
ttest q1_4 == q1_18				if country==5
esize unpaired q1_4 == q1_18	if country==5, cohensd
ttest q1_4 == q1_18				if country==4
esize unpaired q1_4 == q1_18	if country==4, cohensd
ttest q1_4 == q1_18				if country==3
esize unpaired q1_4 == q1_18	if country==3, cohensd
ttest q1_4 == q1_18				if country==2
esize unpaired q1_4 == q1_18	if country==2, cohensd
ttest q1_4 == q1_18				if country==1
esize unpaired q1_4 == q1_18	if country==1, cohensd



signrank q1_1 = q1_16
signrank q1_1 = q1_16 if country==6
signrank q1_1 = q1_16 if country==5
signrank q1_1 = q1_16 if country==4
signrank q1_1 = q1_16 if country==3
signrank q1_1 = q1_16 if country==2
signrank q1_1 = q1_16 if country==1

signrank q1_2 = q1_17
signrank q1_2 = q1_17 if country==6
signrank q1_2 = q1_17 if country==5
signrank q1_2 = q1_17 if country==4
signrank q1_2 = q1_17 if country==3
signrank q1_2 = q1_17 if country==2
signrank q1_2 = q1_17 if country==1

signrank q1_4 = q1_18
signrank q1_4 = q1_18 if country==6
signrank q1_4 = q1_18 if country==5
signrank q1_4 = q1_18 if country==4
signrank q1_4 = q1_18 if country==3
signrank q1_4 = q1_18 if country==2
signrank q1_4 = q1_18 if country==1


********** Logit regressions by country
* Table name
global tabname "logit_by_country"

* Regression(s)
timer clear
local x=0
local z = ""

foreach i of num 1/6 {
foreach dv of varlist neg2_* {
local x=`x'+1
di "Column `x'"
timer on `x'
qui logit `dv' $ivars [pweight=weight] if country==`i', robust
local z`x' m`i'_`x'
local z = "`z'" + " `z`x''"
est store m`i'_`x'
local m="c`x'"
*estimates save "output/$tabname`m'", replace
timer off `x'
timer list `x'
}
}

* In Stata output window
esttab `z' , ///
	mtitles("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	addnotes("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) r2(3) ///
	legend

* Excel-file
estout `z' using "output/$tabname.xls", replace ///
	mlabels("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	postfoot("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par(`"="("' `")""') fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	legend


********************************************************************************
********************************************************************************

********** Ologit regressions by country
* Table name
global tabname "ologit_by_country"

* Regression(s)
timer clear
local x=0
local z = ""

foreach i of num 1/6 {
foreach dv of varlist $dvars {
local x=`x'+1
di "Column `x'"
timer on `x'
qui ologit `dv' $ivars [pweight=weight] if country==`i', robust
local z`x' m`i'_`x'
local z = "`z'" + " `z`x''"
est store m`i'_`x'
local m="c`x'"
*estimates save "output/$tabname`m'", replace
timer off `x'
timer list `x'
}
}

* In Stata output window
esttab `z' , ///
	mtitles("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	addnotes("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) r2(3) ///
	legend

* Excel-file
estout `z' using "output/$tabname.xls", replace ///
	mlabels("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	postfoot("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par(`"="("' `")""') fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	legend

	
	
*** Ologit all countries
* Table name
global tabname "ologit_all"

* Regression(s)
timer clear
local x=0
local z = ""

foreach dv of varlist $dvars {
local x=`x'+1
di "Column `x'"
timer on `x'
qui ologit `dv' $ivars [pweight=weight], robust
local z`x' m`i'_`x'
local z = "`z'" + " `z`x''"
est store m`i'_`x'
local m="c`x'"
*estimates save "output/$tabname`m'", replace
timer off `x'
timer list `x'
}

* In Stata output window
esttab `z' , ///
	mtitles("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	addnotes("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) r2(3) ///
	legend

* Excel-file
estout `z' using "output/$tabname.xls", replace ///
	mlabels("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	postfoot("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par(`"="("' `")""') fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	legend

	
	
	
*** Ologit global north and south
* Table name
global tabname "ologit_north_south"

* Regression(s)
timer clear
local x=0
local z = ""

foreach i of num 0/1 {
foreach dv of varlist $dvars {
local x=`x'+1
di "Column `x'"
timer on `x'
qui ologit `dv' $ivars [pweight=weight] if gsouth==`i', robust
local z`x' m`i'_`x'
local z = "`z'" + " `z`x''"
est store m`i'_`x'
local m="c`x'"
*estimates save "output/$tabname`m'", replace
timer off `x'
timer list `x'
}
}

* In Stata output window
esttab `z' , ///
	mtitles("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	addnotes("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) r2(3) ///
	legend

* Excel-file
estout `z' using "output/$tabname.xls", replace ///
	mlabels("Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing" "Climate: tax" "Climate: sub" "Climate: marketing" "Health: tax" "Health: sub" "Health: marketing") ///
	postfoot("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par(`"="("' `")""') fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	legend

	
	
	
************* Resistance within countries
global negvar "neg2_q1_1 neg2_q1_2 neg2_q1_4 neg2_q1_16 neg2_q1_17 neg2_q1_18"

tab neg2_q1_1 	if country==1
tab neg2_q1_2 	if country==1
tab neg2_q1_4 	if country==1
tab neg2_q1_16	if country==1
tab neg2_q1_17	if country==1
tab neg2_q1_18	if country==1

foreach var of varlist $negvar {
	bysort region_us: tab `var' //change region variable
}


****************** Resistance by IV's
*gender agecat1 agecat2 agecat3 educat1 educat2 educat3 urbcat1 urbcat2 urbcat3 inccat1 inccat2 inccat3
tab neg2_q1_1 	if inccat3==1
tab neg2_q1_2 	if inccat3==1
tab neg2_q1_4 	if inccat3==1
tab neg2_q1_16	if inccat3==1
tab neg2_q1_17	if inccat3==1
tab neg2_q1_18	if inccat3==1





